import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common'
import { TowerService } from './tower.service'
import { CreateTowerDto } from './dto/create-tower.dto'
import { UpdateTowerDto } from './dto/update-tower.dto'

@Controller('tower')
export class TowerController {
  constructor(private readonly towerService: TowerService) {}

  @Post()
  create(@Body() createTowerDto: CreateTowerDto) {
    return this.towerService.create(createTowerDto)
  }

  @Get()
  async findAll(@Query() args = {}) {
    return await this.towerService.findAll(args)
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.towerService.findOne(+id)
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateTowerDto: UpdateTowerDto) {
    return this.towerService.update(+id, updateTowerDto)
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.towerService.remove(+id)
  }

  @Delete('/towers/:id')
  async removeAll(@Param('id') id: string) {
    return await this.towerService.removeAll(+id)
  }
}
